import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { CompanyEsgComponent } from './companyEsg.component';
import { CompanyEsgService } from './companyEsg.service';
import { CompanyESGSummaryComponent } from './summary/esgSummary.component';
import { CompanyESGAnalystViewComponent } from './analystView/esgAnalystView.component';
import { ChartsModule } from '../../../../shared/directives/charts.module';
import { EsgIssueComponent } from './esgIssue/esgIssue.component';
import { EsgClusterComponent } from './esgIssue/esgCluster/esgCluster.component';
import { IssueType } from '../../../../shared/models/issue.enum';
import { CompanyIndicatorModule } from '../shared/companyIndicator/companyIndicator.module';
import { ControversiesSummaryModule } from '../shared/companyControversiesSummary/companyControversiesSummary.module';
import { EsgIndustryLeadPersonnelComponent } from './industryPersonnel/esgIndustryLeadPersonnel.component';
import { CompanyReportDownloadModule } from '../shared/companyHeader/companyReportDownload/companyReportDownload.module';
import { ModalModule } from '../../../../shared/components/modal/modal.module';

const routes: Routes = [
    {
        path: '',
        component: CompanyEsgComponent,
        children: [
            { path: '', redirectTo: 'summary', pathMatch: 'full' },
            {
                path: 'summary', component: CompanyESGSummaryComponent, data: {
                    showAsMenu: true,
                    enabled: true,
                    menuItems: [{
                        title: 'Summary',
                        path: ['esg', 'summary']
                    }]
                }
            },
            {
                path: 'analystView', component: CompanyESGAnalystViewComponent, data: {
                    showAsMenu: true,
                    enabled: true,
                    menuItems: [{
                        title: 'Analyst View',
                        path: ['esg', 'analystView']
                    }]
                }
            },
            {
                path: 'environment', component: EsgIssueComponent, data: {
                    showAsMenu: true,
                    enabled: true,
                    theme: IssueType.Environment,
                    menuItems: [{
                        title: 'Environment',
                        path: ['esg', 'environment']
                    }]
                }
            },
            {
                path: 'social', component: EsgIssueComponent, data: {
                    showAsMenu: true,
                    enabled: true,
                    theme: IssueType.Social,
                    menuItems: [{
                        title: 'Social',
                        path: ['esg', 'social']
                    }]
                }
            },
            {
                path: 'governance', component: EsgIssueComponent, data: {
                    showAsMenu: true,
                    enabled: true, //TODO: set claims if required and on menuItems update call enableMenuRoutes
                    theme: IssueType.Governance,
                    menuItems: [{
                        title: 'Governance',
                        path: ['esg', 'governance']
                    }]
                }
            }
        ]
    },
    { loadChildren: './companyEsg.widget#WidgetModule' } //added to route so we generate a chunk for it
];

/**
 * Company ESG module
 *
 * Author: Sorin Spiru , Andrei Istrate
 * Date: 13.01.2018
 */
@NgModule({  
    imports: [
        CommonModule,
        FormsModule,
        ChartsModule,
        CompanyIndicatorModule,
        ControversiesSummaryModule,
        ChartsModule,
        ModalModule,
        CompanyReportDownloadModule,
        RouterModule.forChild(routes)
    ],
    declarations: [
        CompanyEsgComponent,
        CompanyESGSummaryComponent,
        CompanyESGAnalystViewComponent,
        EsgIssueComponent,
        EsgClusterComponent,
        EsgIndustryLeadPersonnelComponent
    ]
})
export class CompanyEsgModule { }
